package com.archie.xunji.guanzhu.peoples;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.Toast;
import com.archie.xunji.R;
import com.archie.xunji.guanzhu.asyncs.GetPeopleDetailsAsync;

public class PeopleDetailActivity extends Activity implements View.OnClickListener {

    private ImageButton back;
    private ImageButton more;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_people_detail);

        initView();
        initData();
    }

    /**
     * 初始化数据
     */
    private void initData() {
//        RequestParams params = new RequestParams();
//        params.addBodyParameter("userinfoid", "26099");
//        params.addBodyParameter("appuserid", "43480");
//        params.addBodyParameter("t", "20151110121642");
//        params.addBodyParameter("token", "C668F1AB058CBDA5511A431D7B9F13F9C96E576D");
//        params.addBodyParameter("source", "6");
//        params.addBodyParameter("sid", "Co0gh2v0Nr");
//        params.addBodyParameter("imei", "9692B6993494E9324B7F9560912242B7");
//        params.addBodyParameter("os", "Android+4.4.4");
//        params.addBodyParameter("key", "WANDOUJIA");
//        params.addBodyParameter("userid", "70");
//        HttpUtils http = new HttpUtils();
//        http.send(HttpRequest.HttpMethod.POST,
//                "http://service.xunjimap.com/xunjiservice/user/show?4E27AB97B56CB0C3CF6D0C0D8F8EAFBE",
//                params,
//                new RequestCallBack<String>() {
//                    @Override
//                    public void onStart() {
//                    }
//
//                    @Override
//                    public void onLoading(long total, long current, boolean isUploading) {
//                        if (isUploading) {
//                        } else {
//                        }
//                    }
//
//                    @Override
//                    public void onSuccess(ResponseInfo<String> responseInfo) {
//                        Toast.makeText(PeopleDetailActivity.this,responseInfo.result,Toast.LENGTH_SHORT).show();
//                        Log.i("url-->","data-->"+responseInfo.result);
//                    }
//
//                    @Override
//                    public void onFailure(HttpException error, String msg) {
//                        Toast.makeText(PeopleDetailActivity.this,"数据加载失败！",Toast.LENGTH_SHORT).show();
//                    }
//                });
        String url = "http://service.xunjimap.com/xunjiservice/user/show?4E27AB97B56CB0C3CF6D0C0D8F8EAFBE";
        new GetPeopleDetailsAsync(this).execute(url);
    }

    private void initView() {
        back = (ImageButton) findViewById(R.id.people_detail_back);
        more = (ImageButton) findViewById(R.id.people_detail_more);

        back.setOnClickListener(this);
        more.setOnClickListener(this);
    }


    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.people_detail_back:
                finish();
                break;
            case R.id.people_detail_more:
                Toast.makeText(this,"点击了更多",Toast.LENGTH_SHORT).show();
                break;
        }
    }
}
